class <%= @migration_class_name %> < ActiveRecord::Migration[<%= ActiveRecord::Migration.current_version %>]
  def change
  <%- function_definitions.each do |f| -%>
    <%- previous_version = previous_version_for(f.name) -%>
    <%- if previous_version -%>
      <%- if previous_version != f.version -%>
    reversible do |dir|
      dir.up do
        create_function :<%= f.name %>, version: <%= f.version %>
      end

      dir.down do
        create_function :<%= f.name %>, version: <%= previous_version %>
      end
    end
      <%- end %>
    <%- else -%>
    create_function :<%= f.name %>, version: <%= f.version %>
    <%- end %>
  <%- end -%>
  end
end
